//
//  MyLabel.m
//  Cell
//
//  Created by WLJ on 20/10/2016.
//  Copyright © 2016 WLJ. All rights reserved.
//

#import "MyLabelView.h"
#import <Masonry/Masonry.h>
#import <Wonderful/Wonderful-umbrella.h>
#import <Colours/Colours-umbrella.h>
#import <HYBImageCliped/HYBImageCliped-umbrella.h>
@implementation MyLabelView
-(instancetype)init
{
    self = [super init];
    if (self) {
        self.icon.image = [UIImage hyb_imageWithColor:[UIColor easterPinkColor] toSize:CGSizeMake(30, 30) cornerRadius:15 backgroundColor:[UIColor coolPurpleColor] borderColor:[UIColor grassColor] borderWidth:2];
        
        self.backgroundColor = [UIColor ghostWhiteColor];
        
        self.layer.cornerRadius = 10;
        
        [self addSubview:self.label];
        [self addSubview:self.icon];
        [self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.mas_equalTo(self).offset(2);
            make.bottom.mas_equalTo(self).offset(2);
            make.width.height.mas_equalTo(self.mas_height).offset(-4);
            [self.icon hyb_addCornerRadius:self.bounds.size.height*0.5];
        }];
        self.label.font = [UIFont italicSystemFontOfSize:12];
        self.label.textColor = [UIColor black50PercentColor];
        [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.icon.mas_right).offset(2);
            make.right.mas_equalTo(0);
            make.bottom.top.mas_equalTo(0);
        }];
    }
    return self;
}
//-(void)layoutSubviews{
//    [self hyb_addCornerRadius:10];
//    [self setHyb_shouldRefreshCache:NO];
//}
-(UIImageView *)icon{
    if (!_icon) {
        _icon = [UIImageView new];
    }
    return  _icon;
}
-(UILabel *)label{
    if (!_label) {
        _label =[UILabel new];
    }
    return _label;
}

@end
